import React, {useReducer} from 'react'
// 导入需要的reducer和state
import userReducer, {initState} from '../Store/user'

function FnReducer() {
    let [state, dispatch] = useReducer(userReducer, initState)
  return (
    <div>
        <p>FnReducer: 可以在函数组件中使用reducer---这里使用user模块的内容</p>
        <p>{state.info.name}</p>
        <button onClick={()=>dispatch({type: 'changeName', name: 'ff'})}>改名</button>
    </div>
  )
}

export default FnReducer